package com.xupt.ttms.util;

import com.xupt.ttms.pojo.User;

public class ThreadUtils<T> {
    private static final ThreadLocal<String> tokenHolder = new ThreadLocal<>();
    private static final ThreadLocal<User> userHolder = new ThreadLocal<>();

    public static void setToken(String token) {
        tokenHolder.set(token);
    }

    public static String getToken() {
        return tokenHolder.get();
    }

    public static void setUserHolder(User user) {
        userHolder.set(user);
    }

    public static User getUserHolder() {
        return userHolder.get();
    }

    public static void remove() {
        tokenHolder.remove();
        userHolder.remove();
    }
}